"use strict";

var Promise = require("bluebird");

function first(cb){
    var str = "first";
    console.log("begin");
    cb(null, str);
}

function second(data,cb){
    var str = "second";
    console.log(data);
    cb(null, str);
}

var firstAsync = Promise.promisify(first);
var secondAsync = Promise.promisify(second);

firstAsync().then(secondAsync).then(console.log);